using System;
using System.Linq.Expressions;
using ExampleWebApplication.Entities;
using ExampleWebApplication.Models;
using NHibernate;
using TelerikMvcGridCustomBindingHelper.NHibernate;

namespace ExampleWebApplication.Infraestruture.Aggregates
{
    class SumUnitPriceMultipliedByUnitsOnOrderLinqAggregateFunction : NHibernateGridCustomBindingHelper<Product, ProductModel>.LinqAggregateFunction
    {
        protected override Expression<Func<IQueryOver<Product, Product>, IFutureValue<object>>> GetExpression()
        {
            return queryOver => queryOver.Sum(x => x.UnitPrice * x.Units_On_Order);
        }
    }
}